<template>
    <div class="home-download scroll-item">
        <div class="download-wrap ">
            <div class="fromtop clearFix">
                <h3 class="home-title">下载排行
                </h3>
                <div class="cutBtn iconfont" @click="CutList()"> &#xe603;</div>
                <span class="morelist">更多
                    <i class="iconfont icon-gengduo"></i>
                </span>
            </div>
            <div class="download-wrap-content">
                <div class="content-list">
                    <h5>最新游戏</h5>
                    <div class="list-item" v-for="(item, index) in reveal.first" @mouseenter.prevent="mouseState(index, 'newGameList')">
                        <h4 v-show="!item.activate">
                            <span>
                                {{index
                                < 3 ? '' : index + 1}} </span>
                                    <i v-lazy:background-image="item.icon"></i>
                                    {{item.name}}
                        </h4>
                        <div class="list-item-activate" v-show="item.activate">
                            <div class="list-item-activate-icon" v-lazy:background-image="item.icon"></div>
                            <h4>{{item.name}}</h4>
                            <p>{{item.size}}M</p>
                            <i v-if="item.device === 'ios' || item.device === 'h5'" class="iconfont icon-pingguo ios"></i>
                            <i v-if="item.device === 'android' || item.device === 'h5'" class="iconfont icon-anzhuo android"></i>
                        </div>
                    </div>
                </div>
                <div class="content-list">
                    <h5>最热游戏</h5>
                    <div class="list-item" v-for="(item, index) in reveal.second" @mouseenter.prevent="mouseState(index, 'hotGameList')">
                        <h4 v-show="!item.activate">
                            <span>
                                {{index
                                < 3 ? '' : index + 1}} </span>
                                    <i v-lazy:background-image="item.icon"></i>
                                    {{item.name}}
                        </h4>
                        <div class="list-item-activate" v-show="item.activate">
                            <div class="list-item-activate-icon" v-lazy:background-image="item.icon"></div>
                            <h4>{{item.name}}</h4>
                            <p>{{item.size}}M</p>
                            <i v-if="item.device === 'ios' || item.device === 'h5'" class="iconfont icon-pingguo ios"></i>
                            <i v-if="item.device === 'android' || item.device === 'h5'" class="iconfont icon-anzhuo android"></i>
                        </div>
                    </div>
                </div>
                <div class="content-list">
                    <h5>H5游戏</h5>
                    <div class="list-item" v-for="(item, index) in reveal.third" @mouseenter.prevent="mouseState(index, 'h5GameList')">
                        <h4 v-show="!item.activate">
                            <span>
                                {{index
                                < 3 ? '' : index + 1}} </span>
                                    <i v-lazy:background-image="item.icon"></i>
                                    {{item.name}}
                        </h4>
                        <div class="list-item-activate" v-show="item.activate">
                            <div class="list-item-activate-icon" v-lazy:background-image="item.icon"></div>
                            <h4>{{item.name}}</h4>
                            <span>{{item.type}}</span>
                            <span>{{item.label}}</span>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="open-game">
            <h3 class="home-title">开服表
                <a href="#">更多
                    <i class="iconfont icon-gengduo"></i>
                </a>
            </h3>
            <div class="download-wrap-content open-game-content">
                <h5>
                    <span>时间</span>
                    <span>游戏名</span>
                    <span>服务器名</span>
                </h5>
                <div class="open-game-item">
                    <div class="item-left">
                        <span>10-08</span>
                        <span>12:59</span>
                    </div>
                    <div class="item-center">米娱游戏</div>
                    <div class="item-right">南方电信一区</div>
                </div>
            </div>
        </div>
    </div>
</template>

<script>
export default {
  computed: {
    Home: function() {
      return this.$store.state.mock
      //   return this.$store.state.Home
    }
  },
  data() {
    return {
      cutState: 'first',
      reveal: {
        first: this.$store.state.mock.newGame,
        second: this.$store.state.mock.hotDown,
        third: this.$store.state.mock.choicest
      }
    }
  },
  methods: {
    CutList() {
   
      if (this.cutState === 'first') {
        this.cutState ='second'
        this.reveal.first = this.Home.hotDown
        this.reveal.second = this.Home.choicest
        this.reveal.third = this.Home.hotDown 
          this.cutState ='second'
      } else if (this.cutState === 'second') {
        this.reveal.first = this.Home.newGame
        this.reveal.second = this.Home.hotDown
        this.reveal.third = this.Home.choicest  
        this.cutState = 'third'
      } else {
        this.reveal.first = this.Home.newGame
        this.reveal.second = this.Home.choicest
        this.reveal.third = this.Home.hotDown
        this.cutState = 'first'
      }
    },
    mouseState(index, name) {}
  }
}
</script>

<style lang="less" scoped>
@import '../icon/iconfont.css';
.home-download {
  overflow: hidden;
  margin-bottom: 50px;
  .download-wrap {
    width: 73%;
    display: inline-block;
    // float: left;
    .fromtop {
      .home-title {
        display: inline-block;
        line-height: 48px;
        float: left;
      }
      .cutBtn {
        display: inline-block;
        float: left;
        line-height: 50px;
        margin-left: 15px;
        color: #ffa93a;
        font-size: 18px;
      }
      .morelist {
        display: inline-block;
        float: right;
        line-height: 50px;
        font-size: 14px;
        color: #ccc;
        font-weight: bold;
      }
    }
  }
  .open-game {
    width: 25%;
    margin-left: 2%;
    float: right;
  }
  .download-wrap-content {
    background-color: #fff;
    height: 700px;
    width: 100%;
    overflow: hidden;
    .content-list {
      width: 33.33%;
      float: left;
      box-sizing: border-box;
      -webkit-box-sizing: border-box;
      -moz-box-sizing: border-box;
      -ms-box-sizing: border-box;
      -o-box-sizing: border-box;
      h5 {
        background-color: #fee051;
        line-height: 32px;
        text-align: center;
        // margin-bottom: 5px;
      }
    }
    .list-item {
      cursor: pointer;
      & > h4 {
        line-height: 60px;
        border-right: 1px solid #eee;
        border-left: 1px solid #eee;
        border-bottom: 1px solid #eee;
        padding-left: 120px;
        position: relative;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        span {
          width: 26px;
          height: 26px;
          border-radius: 50%;
          text-align: center;
          line-height: 26px;
          background: #d7d7d7;
          color: #999;
          position: absolute;
          left: 15px;
          top: 17px;
        }
        i {
          width: 46px;
          height: 46px;
          background-size: 100%;
          position: absolute;
          left: 60px;
          top: 7px;
        }
      }
      &:nth-child(2) {
        h4 {
          span {
            background: url('../../../assets/icon/number_1_icon.png') no-repeat;
            background-size: 100%;
          }
        }
        .list-item-activate {
          .list-item-activate-icon {
            &:before {
              background: url('../../../assets/icon/number_1_activate.png')
                no-repeat;
            }
          }
        }
      }
      &:nth-child(3) {
        h4 {
          span {
            background: url('../../../assets/icon/number_2_icon.png') no-repeat;
            background-size: 100%;
          }
        }
        .list-item-activate {
          .list-item-activate-icon {
            &:before {
              background: url('../../../assets/icon/number_2_activate.png')
                no-repeat;
            }
          }
        }
      }
      &:nth-child(4) {
        h4 {
          span {
            background: url('../../../assets/icon/number_3_icon.png') no-repeat;
            background-size: 100%;
          }
        }
        .list-item-activate {
          .list-item-activate-icon {
            &:before {
              background: url('../../../assets/icon/number_3_activate.png')
                no-repeat;
            }
          }
        }
      }
      &:nth-child(5) {
        .list-item-activate {
          .list-item-activate-icon {
            &:before {
              background: url('../../../assets/icon/number_4_activate.png')
                no-repeat;
            }
          }
        }
      }
      &:nth-child(6) {
        .list-item-activate {
          .list-item-activate-icon {
            &:before {
              background: url('../../../assets/icon/number_5_activate.png')
                no-repeat;
            }
          }
        }
      }
      &:nth-child(7) {
        .list-item-activate {
          .list-item-activate-icon {
            &:before {
              background: url('../../../assets/icon/number_6_activate.png')
                no-repeat;
            }
          }
        }
      }
      &:nth-child(8) {
        .list-item-activate {
          .list-item-activate-icon {
            &:before {
              background: url('../../../assets/icon/number_7_activate.png')
                no-repeat;
            }
          }
        }
      }
      &:nth-child(9) {
        .list-item-activate {
          .list-item-activate-icon {
            &:before {
              background: url('../../../assets/icon/number_8_activate.png')
                no-repeat;
            }
          }
        }
      }
      &:nth-child(10) {
        .list-item-activate {
          .list-item-activate-icon {
            &:before {
              background: url('../../../assets/icon/number_9_activate.png')
                no-repeat;
            }
          }
        }
      }
      &:nth-child(11) {
        .list-item-activate {
          .list-item-activate-icon {
            &:before {
              background: url('../../../assets/icon/number_10_activate.png')
                no-repeat;
            }
          }
        }
      }
    }
    .list-item-activate {
      padding: 20px 0 20px 120px;
      position: relative;
      height: 80px;
      border-right: 1px solid #eee;
      border-left: 1px solid #eee;
      border-bottom: 1px solid #eee;
      .list-item-activate-icon {
        width: 80px;
        height: 80px;
        background-size: 100%;
        position: absolute;
        left: 25px;
        top: 20px;
        &:before {
          content: '';
          width: 60px;
          height: 60px;
          background-size: 100%;
          position: absolute;
          left: -25px;
          top: -20px;
        }
      }
      h4 {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        color: #333;
        padding-top: 3px;
      }
      p {
        line-height: 34px;
        color: #ffa93a;
      }
      span {
        display: inline-block;
        color: #ffa93a;
        margin-right: 12px;
        margin-top: 12px;
        font-size: 14px;
      }
      .ios {
        color: #c6e2a6;
        font-size: 24px;
        margin-right: 10px;
      }
      .android {
        color: #9de1f5;
        font-size: 20px;
      }
    }
  }
  .open-game-content {
    h5 {
      line-height: 32px;
      background-color: #fee051;
      color: #333;
      padding: 0 20px;
      span {
        display: inline-block;
        width: 33.33%;
        text-align: left;
      }
    }
  }
  .open-game-item {
    display: flex;
    display: -webkit-flex;
    display: -ms-flexbox;
    height: 84px;
    margin: 0 20px;
    border-bottom: 1px solid #eee;
    .item-left {
      flex: 1;
      -ms-flex: 1;
      -webkit-box-flex: 1;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      line-height: 84px;
      font-weight: 600;
      font-size: 14px;
      span {
        display: block;
        line-height: 1;
        &:nth-child(1) {
          padding-top: 25px;
          padding-bottom: 3px;
        }
      }
    }
    .item-center {
      .item-left;
    }
    .item-right {
      .item-left;
    }
  }
}
</style>


